package com.bi.bitest.bao.adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.bi.bitest.bao.fragments.BaseFragment;

import java.util.List;

/**
 * Created
 * Author:bi[FR]
 * Date:15-10-20
 */
public class CommonFragmentPagerAdapter extends FragmentPagerAdapter {
    private List<BaseFragment>fragments;

    public CommonFragmentPagerAdapter(FragmentManager fm,List<BaseFragment> fragments) {
        super(fm);
        this.fragments=fragments;
    }

    @Override
    public Fragment getItem(int position) {

        return fragments.get(position);
    }

    @Override
    public int getCount() {
        int ret=0;
        if(fragments!=null)
            ret=fragments.size();
        return ret;
    }

    @Override
    public CharSequence getPageTitle(int position) {

        String ret=null;
        BaseFragment baseFragment=fragments.get(position);
        ret=baseFragment.getFragmentTitle();

        return ret;
    }
}
